#ifndef SERVICEPUBLISHER_H_
#define SERVICEPUBLISHER_H_

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

#include <avahi-client/client.h>
#include <avahi-client/lookup.h>
#include <avahi-client/publish.h>

#include <avahi-common/simple-watch.h>
#include <avahi-common/malloc.h>
#include <avahi-common/error.h>

#include "../util/Configuration.h"
#include "../util/exception/ServicePublisherException.h"
#include "UDPServer.h"

using std::string;

class ServicePublisher {
private:
	static AvahiSimplePoll *simple_poll;
	static AvahiEntryGroup *group;
	static AvahiClient *client;
	static UDPServer* udp_server;

	ServicePublisher();
	static void client_callback(AvahiClient *c, AvahiClientState state,
			AVAHI_GCC_UNUSED void * userdata);
	static void group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state,
			void *userdata);
	static void signal_handler(int signal_code);

public:
	static void publish();
};

#endif /* SERVICEPUBLISHER_H_ */
